<template>
    <div class="f-tag-list" :style="{ left: appStore.asideWidth }">
        <el-tabs v-model="activeTab" type="card" class="flex-1" style="min-width: 100px" @tab-remove="removeTab" @tab-change="changeTab">
            <el-tab-pane v-for="item in tabList" :key="item.path" :closable="item.path != '/'" :label="item.title" :name="item.path"></el-tab-pane>
        </el-tabs>

        <span class="tag-btn !ml-2">
            <el-dropdown @command="handleClose">
                <span class="el-dropdown-link outline-none">
                    <el-icon>
                        <arrow-down />
                    </el-icon>
                </span>
                <template #dropdown>
                    <el-dropdown-menu>
                        <el-dropdown-item command="clearOther">关闭其他</el-dropdown-item>
                        <el-dropdown-item command="clearAll">全部关闭</el-dropdown-item>
                    </el-dropdown-menu>
                </template>
            </el-dropdown>
        </span>
    </div>
    <div style="height: 44px"></div>
</template>
<script setup>
import { useTabList } from '~/composables/useTabList.js'
import { useAppStore } from '~/stores/app'

const { activeTab, tabList, changeTab, removeTab, handleClose } = useTabList()
const appStore = useAppStore()
</script>
<style scoped>
.f-tag-list {
    @apply fixed flex items-center bg-gray-100 px-2;
    top: 64px;
    right: 0;
    height: 44px;
    z-index: 100;
}
:deep(.el-tabs__nav-prev),
:deep(.el-tabs__nav-next),
.tag-btn {
    @apply ml-auto flex items-center justify-center rounded bg-white px-2 text-xl text-black !opacity-100;
    height: 32px;
}
:deep(.el-tabs__header) {
    border: 0 !important;
    @apply mb-0 flex items-center;
}
:deep(.el-tabs__nav) {
    border: 0 !important;
}
:deep(.el-tabs__item) {
    border: 0 !important;
    height: 32px;
    line-height: 32px;
    @apply mx-1 rounded bg-white;
}
:deep(.el-tabs__nav-next),
:deep(.el-tabs__nav-prev) {
    line-height: 32px;
    height: 32px;
}
:deep(.is-disabled) {
    cursor: not-allowed;
    @apply text-gray-300;
}
</style>
